package com.meritdata.cloud.data.service.datadirectory.controller;

import com.meritdata.cloud.data.service.datadirectory.service.IDownloadProposeService;
import com.meritdata.cloud.resultmodel.ResultBody;
import com.meritdata.cloud.resultmodel.ResultStatus;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/directory")
@Api(value = "数据审批展示信息-DataDirectoryController", tags = "数据审批展示信息")
public class DataDirectoryController {

    @Autowired
    private IDownloadProposeService downloadProposeService;

    /*审批页面首页展示以及搜索框单选框方法*/
    /**
     *  search:搜索内容
     *  state:审批状态
     */
    @RequestMapping("/list")
    @ApiOperation(value = "获取数据审批字段信息接口", notes = "根据搜索信息和审核状态获取对应的数据审批字段信息")
    public ResultBody getDataTableInfoList(@ApiParam(value = "搜索信息") @RequestParam String search, @ApiParam(value = "审核状态") @RequestParam int state){
        try {
            return ResultBody.success(downloadProposeService.getDataApprovalList(search,state));
        }catch (RuntimeException e){
            return ResultBody.failure(ResultStatus.DATA_OPERATION_ERROR, e);
        }
    }
    /*根据id获取*/
}
